package com.pkx.cloud.fse7.dms.openpic.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pkx.cloud.fse7.dms.openpic.entity.OpenPic;
import com.pkx.cloud.fse7.dms.openpic.service.OpenPicService;
import com.pkx.cloud.whzx.comn.ORpose;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

/**
 * 门禁 控制器
 *
 * @author ly
 * @since 2020-10-14
 */
@RestController
@RequestMapping("/dms/openpic/open-pic")
@Api(value = "门禁", tags = "门禁")
@Slf4j
@ORpose
public class OpenPicController {

    @Autowired
    private OpenPicService openPicService;

    @ApiOperation("门禁分页列表")
    @GetMapping("/page")
    public Page<OpenPic> page(Page page, OpenPic openPic) {
        return openPicService.pageList(page,openPic);
    }

    @ApiOperation("门禁列表")
    @GetMapping("/list")
    public List<OpenPic> list(OpenPic openPic) {
        return openPicService.listByEntity(openPic);
    }

    @ApiOperation("门禁详情")
    @GetMapping(value = "/{id}")
    public OpenPic selectById(@PathVariable("id") Long id) {
        return openPicService.selectById(id);
    }

    @ApiOperation("门禁抓拍照片添加")
    @PostMapping("add")
    String add(@RequestBody OpenPic openPic){
       return openPicService.add(openPic);
    }

    @ApiOperation("门禁抓拍照片修改")
    @PostMapping("update")
    String update(@RequestBody OpenPic openPic){
        return openPicService.update(openPic);
    }

    @ApiOperation(("门禁抓拍照片删除"))
    @PostMapping("delete")
    String delete(String id){
        return  openPicService.delete(id);
    }
}
